<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./style.css">
</head>
<body>
    <div class="nav">
        <div class="toggle"><span></span></div>
        <ul>
            <li style="--i:0;"><a onclick="aClick(this.text)" href="#">首页</a></li>
            <li style="--i:1;"><a onclick="aClick(this.text)" href="#">关于</a></li>
            <li style="--i:2;"><a onclick="aClick(this.text)" href="#">服务项目</a></li>
            <li style="--i:3;"><a onclick="aClick(this.text)" href="#">留言</a></li>
            <li style="--i:4;"><a onclick="aClick(this.text)" href="#">联系我们</a></li>
        </ul>
    </div>
    <script>
        let nav = document.querySelector('.nav');
        document.querySelector('.toggle').onclick = function(){
            this.classList.toggle('active');
            nav.classList.toggle('active');
        }
        function aClick(value){
            // 点击哪个弹窗哪个的内容
            alert(value);
        }
    </script>
</body>
</html>